﻿<%@ Page Language="C#" MasterPageFile="~/Shared/ContentMaster.master" AutoEventWireup="true"
    CodeFile="ipList.aspx.cs" Inherits="ltMan_users_ipList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<script>
    function PopUpShowing(sender, eventArgs) {
        var popUp = eventArgs.get_popUp();
        var gridWidth = sender.get_element().offsetWidth;
        var popUpWidth = parseInt(popUp.style.width);
        popUp.style.left = ((gridWidth - popUpWidth) / 2 + sender.get_element().offsetLeft).toString() + "px";
    } 
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="CPH1" runat="Server">
    <telerik:RadAjaxManagerProxy runat="server" ID="proxy1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>
    <telerik:RadGrid ID="RadGrid1" runat="server" Width="100%" OnDeleteCommand="RadGrid1_DeleteCommand"
        PageSize="12" OnItemCreated="RadGrid1_ItemCreated" OnInsertCommand="RadGrid1_InsertCommand"
        OnUpdateCommand="RadGrid1_UpdateCommand" OnItemDataBound="RadGrid1_ItemDataBound">
        <ClientSettings><ClientEvents OnPopUpShowing="PopUpShowing" />
            <Scrolling AllowScroll="true" UseStaticHeaders="true" ScrollHeight="340" />
        </ClientSettings>
        <MasterTableView CommandItemDisplay="Top" EditMode="PopUp" DataKeyNames="i_id">
            <CommandItemTemplate>
                <telerikEx:GridCommandEx ID="GridCommandEx1" runat="server" />
            </CommandItemTemplate>
            <PagerTemplate>
                <telerikEx:RadPagerEx ID="RadPagerEx1" runat="server" />
            </PagerTemplate>
            <Columns>
                <telerik:GridClientSelectColumn HeaderStyle-Width="28" ItemStyle-Width="28" />
                <telerik:GridBoundColumn DataField="i_id" Visible="false" />
                <telerik:GridBoundColumn HeaderText="ip" DataField="i_ip" DataFormatString="<nobr>{0}</nobr>" />
                <telerik:GridTemplateColumn HeaderStyle-Width="40" HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-HorizontalAlign="Center" HeaderText="类型">
                    <ItemTemplate>
                        <%# Convert.ToByte(Eval("i_type"))==0?"允许":"拒绝" %>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderStyle-Width="50" HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-HorizontalAlign="Center" HeaderText="操作">
                    <ItemTemplate>
                        <telerikEx:GridInlineCommandEx ID="GridInlineCommandEx1" runat="server" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
            <EditFormSettings EditFormType="Template" CaptionFormatString="当前修改[{0}]" CaptionDataField="i_ip"
                InsertCaption="添加ip">
                <PopUpSettings Modal="true" Width="270" Height="270" />
                <FormTemplate>
                    <div class="pad10"><div class="pad10">
                        <div class="pad10">
                            <br />
                            <asp:HiddenField ID="HiddenField11" runat="server" Value='<%#Bind("i_id") %>' />
                            <telerik:RadTextBox MaxLength="15" Label="IP地址：" ClientEvents-OnKeyPress="function(s,e){var k=e.get_keyCode();if (!((k>=48&&k<=57)||k==46||k==42)){e.set_cancel(true);}}"
                                ZeroPadNumericRanges="false" ID="RadTextBox1" runat="server" Text='<%# Bind("i_ip" ) %>'
                                ToolTip="输入IP" EmptyMessage="输入IP" Width="180" /><asp:RequiredFieldValidator runat="server"
                                    ID="r1" ControlToValidate="RadTextBox1" Display="Dynamic" ErrorMessage="<br/>ip必填" />
                        </div>
                        <div class="pad10">
                            <br />
                            <label>
                                类型：</label>
                            <asp:HiddenField ID="HiddenField2" runat="server" Value='<%# Bind("i_type") %>' />
                            <telerik:RadButton ID="cSex" runat="server" ToggleType="CustomToggle" UseSubmitBehavior="false"
                                AutoPostBack="false" CausesValidation="false">
                                <ToggleStates>
                                    <telerik:RadButtonToggleState Text="允许" PrimaryIconCssClass="rbToggleCheckboxChecked" />
                                    <telerik:RadButtonToggleState Text="拒绝" PrimaryIconCssClass="rbToggleCheckbox" />
                                </ToggleStates>
                            </telerik:RadButton>
                        </div>
                        <div class="ta-center pad10">
                            <br />
                            <telerik:RadButton ID="btnUpdate" Text="更新" runat="server" CommandName="Update" Visible='<%# !(Container.DataItem is Telerik.Web.UI.GridInsertionObject) %>'
                                Icon-PrimaryIconCssClass="icon-edit" />
                            <telerik:RadButton ID="btnInsert" Text="插入" runat="server" CommandName="PerformInsert"
                                Visible='<%# Container.DataItem is Telerik.Web.UI.GridInsertionObject %>' Icon-PrimaryIconCssClass="icon-add" />
                            <telerik:RadButton ID="btnCancel" Text="取消" runat="server" CausesValidation="False"
                                CommandName="Cancel" Icon-PrimaryIconCssClass="icon-cancel" />
                        </div></div>
                    </div>
                </FormTemplate>
            </EditFormSettings>
        </MasterTableView>
    </telerik:RadGrid>
</asp:Content>